//
//  LBShareCancelBtn.m
//  app
//
//  Created by 杨庆人 on 17/4/10.
//  Copyright © 2017年 NAICAI LI. All rights reserved.
//

#import "LBShareCancelBtn.h"
#import <Masonry/Masonry.h>
@interface LBShareCancelBtn ()
@property (nonatomic,strong)UIButton * button;
@property (nonatomic,strong)UIImageView * line;
@end
@implementation LBShareCancelBtn

- (UIButton *)button {
    if (!_button) {
        _button = [UIButton buttonWithType:UIButtonTypeCustom];
        [_button setTitle:@"取消" forState:UIControlStateNormal];
        [_button setTitleColor:[UIColor colorWithRed:74/255.0 green:144/255.0 blue:226/255.0 alpha:1] forState:UIControlStateNormal];
        [_button addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
    }
    return _button;
}
- (UIImageView *)line {
    if (!_line) {
        _line = [[UIImageView alloc] init];
        _line.backgroundColor = [UIColor colorWithRed:134/255.0 green:134/255.0 blue:134/255.0 alpha:0.5];
    }
    return _line;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    __weak typeof(self)weakSelf = self;
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(weakSelf);
    }];
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(weakSelf);
        make.height.mas_equalTo(0.5);
    }];
}
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.button];
        [self addSubview:self.line];
        
    }
    return self;
}

- (void)btnClick {
    !self.clickBlock ? :self.clickBlock();
}

@end
